package principle.singleresponsibility;

/**
 * 单一职责原则演示
 *  遵循单一职责原则
 * @author Fengdong.Duan
 * @create 2023/11/7 9:51
 */
public class SingleResponsibility2 {
    public static void main(String[] args) {
        WaterVehicle waterVehicle = new WaterVehicle();
        waterVehicle.run("轮船");
        AirVehicle airVehicle = new AirVehicle();
        airVehicle.run("飞机");
        RoadVehicle roadVehicle = new RoadVehicle();
        roadVehicle.run("自行车");
    }
}

class WaterVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在水上运行");
    }
}

class AirVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在水上运行");
    }
}

class RoadVehicle {
    public void run(String vehicle) {
        System.out.println(vehicle + "在水上运行");
    }
}

